package com.ars.common.servlet;

import com.ars.common.dao.UpdataAdminMysql;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/updataAdminServlet")
public class updataAdminServlet extends HttpServlet {
    public void doPost(HttpServletRequest request, HttpServletResponse response){
        String UserID = request.getParameter("id");
        String AdminID = request.getParameter("AdminID");

        UpdataAdminMysql up= new UpdataAdminMysql();
        try {

            if(up.updataAdmin(AdminID,UserID))
            {
                String url = request.getContextPath() + "/UserPermissionSettingsServlet";
                response.sendRedirect(url);
            }
            else
            {
                response.getWriter().write("false");
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
